Skip to content

[https://nvbugs/5527956][fix] AutoDeploy: fix IMA due to outdated metadata - #8002

Merged
lucaslie merged 2 commits into
NVIDIA:mainfrom
nv-auto-deploy:ll/fix_device_copy
Sep 26, 2025
Merged

[https://nvbugs/5527956][fix] AutoDeploy: fix IMA due to outdated metadata#8002
lucaslie merged 2 commits into
NVIDIA:mainfrom
nv-auto-deploy:ll/fix_device_copy

Conversation

@lucaslie

@lucaslie lucaslie commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes

    • Improved runtime validation and automatic resizing to prevent size-mismatch errors during deployment.
    • Ensured cache and page assignment data are fully reset before writing new values, reducing potential state carryover issues.
  • Tests

    • Re-enabled a previously skipped accuracy test, reflecting improved dtype handling and increased test coverage.

Description

Benchmarking

trtllm-bench --model meta-llama/Meta-Llama-3.1-70B-Instruct  throughput --dataset /tmp/synthetic_128_128.txt --backend _autodeploy --extra_llm_api_options examples/auto_deploy/bench.yaml --tp 4 --max_batch_size=512

AutoDeploy post-changes

===========================================================
= PERFORMANCE OVERVIEW 
===========================================================
Request Throughput (req/sec):                     46.4220
Total Output Throughput (tokens/sec):             5942.0141
Total Token Throughput (tokens/sec):              11884.0283
Total Latency (ms):                               21541.5173
Average request latency (ms):                     16875.9192
Per User Output Throughput [w/ ctx] (tps/user):   8.1624
Per GPU Output Throughput (tps/gpu):              1485.5035

AutoDeploy pre-changes

===========================================================
= PERFORMANCE OVERVIEW 
===========================================================
Request Throughput (req/sec):                     46.2991
Total Output Throughput (tokens/sec):             5926.2847
Total Token Throughput (tokens/sec):              11852.5694
Total Latency (ms):                               21598.6923
Average request latency (ms):                     16917.2744
Per User Output Throughput [w/ ctx] (tps/user):   8.1431
Per GPU Output Throughput (tps/gpu):              1481.5712

PyTorch

===========================================================
= PERFORMANCE OVERVIEW 
===========================================================
Request Throughput (req/sec):                     48.7223
Total Output Throughput (tokens/sec):             6236.4594
Total Token Throughput (tokens/sec):              12472.9189
Total Latency (ms):                               20524.4660
Average request latency (ms):                     16033.7262
Per User Output Throughput [w/ ctx] (tps/user):   8.6087
Per GPU Output Throughput (tps/gpu):              1559.1149

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

Details

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@lucaslie

Copy link
Copy Markdown
Contributor Author

/bot run

@coderabbitai

coderabbitai Bot commented Sep 25, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Introduces runtime resizing and validation in attention_interface._store_arg and updates nest_sequences to use reset=True when storing page assignment metadata. Also removes one skipped test entry from tests/integration/test_lists/waives.txt.

Changes

Cohort / File(s) Summary
Attention interface runtime resizing and reset handling
tensorrt_llm/_torch/auto_deploy/custom_ops/attention_interface.py
_store_arg now validates sizes: resizes device tensor when reset=True if host tensor is larger; otherwise raises ValueError with detailed size info. nest_sequences now stores cache_loc and pages_per_seq with reset=True.
Integration tests skiplist update
tests/integration/test_lists/waives.txt
Removed one SKIP entry for accuracy/test_llm_api_autodeploy.py::TestLlama3_1_8B::test_auto_dtype.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant H as Host
  participant AI as attention_interface._store_arg
  participant DT as DeviceTensor

  H->>AI: store_arg(host_tensor, device_tensor, reset)
  AI->>AI: Check host vs device size
  alt reset=True and host > device
    AI->>DT: Resize to host size
    AI->>DT: Write data
    DT-->>AI: OK
  else host <= device
    AI->>DT: Write data
    DT-->>AI: OK
  else reset=False and host > device
    AI-->>H: Raise ValueError (available vs required)
  end
Loading
sequenceDiagram
  autonumber
  participant NS as nest_sequences
  participant AI as attention_interface._store_arg
  participant DT1 as cache_loc
  participant DT2 as pages_per_seq

  NS->>AI: store_arg(cache_loc_host, DT1, reset=True)
  AI->>DT1: Reset/resize if needed, write
  NS->>AI: store_arg(pages_per_seq_host, DT2, reset=True)
  AI->>DT2: Reset/resize if needed, write
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description omits the required title and summary directive, providing only benchmark numbers under the “Description” heading without explaining the issue or solution. The “Test Coverage” section is blank with no tests listed, and the template’s structured fields have not been populated. As a result, the submission does not conform to the repository’s PR description template. Please add a PR title following the [ticket][type] format or via the @coderabbitai summary directive, include a concise explanation of the changes and their rationale in the Description section, and populate the Test Coverage section with relevant test cases to fully meet the repository’s PR template requirements.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title Check ✅ Passed The title follows the project’s convention by referencing the NVBugs ID, using the correct “[fix]” tag, and concisely indicating that the AutoDeploy component is being updated to repair issues arising from outdated metadata; it accurately reflects the primary change in the diff.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lucaslie

Copy link
Copy Markdown
Contributor Author

/bot run

@lucaslie
lucaslie requested review from suyoggupta and removed request for Fridah-nv September 25, 2025 15:20
@lucaslie lucaslie moved this from Backlog to In review in AutoDeploy Board Sep 25, 2025
@lucaslie lucaslie self-assigned this Sep 25, 2025
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19972 [ run ] triggered by Bot

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tensorrt_llm/_torch/auto_deploy/custom_ops/attention_interface.py (1)

554-558: Fix typing for Python 3.8 compatibility (use Union instead of |).

The annotation List[int | float] uses PEP 604 unions, which are 3.10+. Per guidelines, target Python 3.8+. Replace with List[Union[int, float]].

Apply this diff:

-        tnsr_like: List[int | float],
+        tnsr_like: List[Union[int, float]],
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2dc93c6 and fe6739c.

📒 Files selected for processing (2)
  • tensorrt_llm/_torch/auto_deploy/custom_ops/attention_interface.py (2 hunks)
  • tests/integration/test_lists/waives.txt (0 hunks)
💤 Files with no reviewable changes (1)
  • tests/integration/test_lists/waives.txt
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Use only spaces, no tabs; indent with 4 spaces.

Files:

  • tensorrt_llm/_torch/auto_deploy/custom_ops/attention_interface.py
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+.
Indent Python code with 4 spaces; do not use tabs.
Maintain module namespace when importing; prefer 'from package.subpackage import foo' then 'foo.SomeClass()' instead of importing the class directly.
Python filenames should be snake_case (e.g., some_file.py).
Python classes use PascalCase names.
Functions and methods use snake_case names.
Local variables use snake_case; prefix 'k' for variables that start with a number (e.g., k_99th_percentile).
Global variables use upper SNAKE_CASE prefixed with 'G' (e.g., G_MY_GLOBAL).
Constants use upper SNAKE_CASE (e.g., MY_CONSTANT).
Avoid shadowing variables from an outer scope.
Initialize all externally visible members of a class in the constructor.
Prefer docstrings for interfaces that may be used outside a file; comments for in-function or file-local interfaces.
Use Google-style docstrings for classes and functions (Sphinx-parsable).
Document attributes and variables inline so they render under the class/function docstring.
Avoid reflection when a simpler, explicit approach suffices (e.g., avoid dict(**locals()) patterns).
In try/except, catch the most specific exceptions possible.
For duck-typing try/except, keep the try body minimal and use else for the main logic.

Files:

  • tensorrt_llm/_torch/auto_deploy/custom_ops/attention_interface.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Prepend the NVIDIA Apache-2.0 copyright header with current year to the top of all source files (e.g., .cpp, .h, .cu, .py).

Files:

  • tensorrt_llm/_torch/auto_deploy/custom_ops/attention_interface.py
🧬 Code graph analysis (1)
tensorrt_llm/_torch/auto_deploy/custom_ops/attention_interface.py (1)
tensorrt_llm/_utils.py (1)
  • numel (975-976)
🪛 Ruff (0.13.1)
tensorrt_llm/_torch/auto_deploy/custom_ops/attention_interface.py

580-583: Avoid specifying long messages outside the exception class

(TRY003)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (1)
tensorrt_llm/_torch/auto_deploy/custom_ops/attention_interface.py (1)

645-647: Verify no implicit dependencies on num_pages == len(cache_loc)
Grep reveals many cache_loc references across custom ops and tests; audit slices and loops to ensure decoupling from num_pages doesn’t break assumptions.

Comment thread tensorrt_llm/_torch/auto_deploy/custom_ops/attention_interface.py Outdated
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19971 [ run ] triggered by Bot

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19972 [ run ] completed with state ABORTED
LLM/main/L0_MergeRequest_PR #15034 (Blue Ocean) completed with status: ABORTED

@lucaslie lucaslie changed the title [https://nvbugs/5527956][fix] AutoDeploy: fix metadata to device copies with better resize/reset [https://nvbugs/5527956][fix] AutoDeploy: fix IMA due to outdated metadata Sep 25, 2025
@lucaslie

Copy link
Copy Markdown
Contributor Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19976 [ run ] triggered by Bot

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19971 [ run ] completed with state ABORTED
LLM/main/L0_MergeRequest_PR #15038 (Blue Ocean) completed with status: ABORTED

@lucaslie

Copy link
Copy Markdown
Contributor Author

/bot run

Comment thread tensorrt_llm/_torch/auto_deploy/custom_ops/attention_interface.py Outdated
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19979 [ run ] triggered by Bot

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19976 [ run ] completed with state ABORTED
LLM/main/L0_MergeRequest_PR #15039 (Blue Ocean) completed with status: ABORTED

@lucaslie
lucaslie force-pushed the ll/fix_device_copy branch 3 times, most recently from 1eccc57 to b9dcfa6 Compare September 25, 2025 16:56
@lucaslie

Copy link
Copy Markdown
Contributor Author

/bot kill

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19981 [ kill ] triggered by Bot

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19979 [ run ] completed with state ABORTED
LLM/main/L0_MergeRequest_PR #15042 (Blue Ocean) completed with status: ABORTED

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19981 [ kill ] completed with state SUCCESS
Successfully killed previous jobs for commit d9274a6

Comment thread tensorrt_llm/_torch/auto_deploy/custom_ops/attention_interface.py
Comment thread tensorrt_llm/_torch/auto_deploy/transform/library/cleanup_input_constraints.py Outdated
@suyoggupta
suyoggupta self-requested a review September 25, 2025 17:30
@lucaslie
lucaslie force-pushed the ll/fix_device_copy branch 2 times, most recently from ff0e15d to 68a8bc5 Compare September 25, 2025 18:32
…es with better reset/sizing

Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
@lucaslie

Copy link
Copy Markdown
Contributor Author

/bot run

@lucaslie
lucaslie enabled auto-merge (squash) September 25, 2025 20:02
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19991 [ run ] triggered by Bot

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19991 [ run ] completed with state FAILURE
/LLM/main/L0_MergeRequest_PR pipeline #15053 completed with status: 'FAILURE'

@lucaslie

Copy link
Copy Markdown
Contributor Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19994 [ run ] triggered by Bot

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #19994 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #15056 completed with status: 'FAILURE'

@lucaslie

Copy link
Copy Markdown
Contributor Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #20019 [ run ] triggered by Bot

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #20019 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #15079 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

@lucaslie
lucaslie merged commit 3a96d75 into NVIDIA:main Sep 26, 2025
5 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AutoDeploy Board Sep 26, 2025
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Nov 1, 2025
…adata (NVIDIA#8002)

Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Nov 3, 2025
…adata (NVIDIA#8002)

Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Nov 3, 2025
…adata (NVIDIA#8002)

Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Nov 3, 2025
…adata (NVIDIA#8002)

Signed-off-by: Lucas Liebenwein <11156568+lucaslie@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants